#include <Windows.h>
#include "CTimer.h"


CTimer::CTimer()
{
	m_dElapsedTime = 0.0;
}


CTimer::~CTimer()
{

}


CTimer* CTimer::GetInstance()
{
	static CTimer timer;
	return &timer;
}


void CTimer::StartUp()
{
	QueryPerformanceCounter(&m_lnLastTime);
	QueryPerformanceFrequency(&m_lnFreq);
}


void CTimer::ShutDown()
{

}


double CTimer::GetDelta()
{
	return m_dElapsedTime;
}


void CTimer::Update()
{
	QueryPerformanceCounter(&m_lnCurrentTime);
	m_dElapsedTime = (double)((m_lnCurrentTime.QuadPart - m_lnLastTime.QuadPart) / (double)m_lnFreq.QuadPart);
	m_lnLastTime = m_lnCurrentTime;
}